package cn.jjxx.modules.sys.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.alibaba.fastjson.JSON;

import cn.jjxx.core.common.controller.BaseBeanController;
import cn.jjxx.core.model.AjaxJson;
import cn.jjxx.core.utils.StringUtils;
import cn.jjxx.modules.sys.service.IInfcService;

/**   
 * @Title: 接口列表
 * @Description: 接口列表
 * @author jjxx
 * @date 2018-01-13 00:29:11
 * @version V1.0   
 *
 */
@Controller
@RequestMapping("getway/network/") 
public class GetwayController extends BaseBeanController {

	 @Autowired
	 protected IInfcService infcService;
    
    /**
     * 根据code获取接口数据
     * @param request 接口编号
     * @return json
     */
    /**
     * 根据code获取接口数据
     * @param request 接口编号
     * @return json
     */
    @RequestMapping(value = "getnetdata",method ={RequestMethod.POST, RequestMethod.GET})
    @ResponseBody
    public void infcData(HttpServletRequest request,HttpServletResponse response) {
    	try {
    		AjaxJson result = infcService.infcData(request);
        	String content = JSON.toJSONString(result.getData());
            StringUtils.printJson(response, content);
    	}
    	catch(Exception ex) 
    	{
    		AjaxJson result = new AjaxJson();
    		result.setRet(-1);
    		result.fail("查询失败");
    		String content = JSON.toJSONString(result);
            StringUtils.printJson(response, content);
    	} 
    } 
}
